package com.xmut.rc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xmut.rc.entity.RentInfo;
import com.xmut.rc.entity.vo.RentInfoVo;
import com.xmut.rc.mapper.RentInfoMapper;
import com.xmut.rc.service.CarInfoService;
import com.xmut.rc.service.RentInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 出租信息表 服务实现类
 * </p>
 *
 * @author ccm
 * @since 2022-06-26
 */
@Service
public class RentInfoServiceImpl extends ServiceImpl<RentInfoMapper, RentInfo> implements RentInfoService {

    @Resource
    private CarInfoService carInfoService;

    @Override
    public List<RentInfoVo> getRentList(QueryWrapper<RentInfoVo> queryWrapper) {
        return this.baseMapper.getRentList(queryWrapper);
    }

    @Override
    public boolean editStatus(String id, String status) {
        RentInfo rent = getById(id);
        rent.setStatus(status);
        carInfoService.editStatus(rent.getCarId(),status);
        return updateById(rent);
    }
}
